<%@page contentType="text/html; charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="/static/jquery/bootstrap_3.3.0/css/bootstrap.min.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="/static/jquery/jquery-1.11.1-min.js"></script>
<script type="text/javascript" src="/static/jquery/bootstrap_3.3.0/js/bootstrap.min.js"></script>
<script type="text/javascript">
	jQuery(function ($) {
		$("#btn").click(function () {
			//登录账户去空格
			var act =$.trim($("#loginAct").val());
			//将去空格的值重新赋值给登录的输入标签
			$("#loginAct").val(act)
			//判断登录账号是否有值，如果为没有；则返回即可
			if(!act){
				alert("请输入账号！");
				//是账户输入框获取焦点
				$("#loginAct").focus();
				return;
			}
			//判断密码是否输入，若没有值，则返回即可
			if(!$("#loginPwd").val()){
				alert("请输入密码！");
				return;
				//密码可以存在空格，所以不必除去空格
			}

			//账号。密码都输入后，按需求：进行ajax请求
			//获取多选框的被选中的的状态：如果被选中，为true,则需要进行密账号码保存
			var loginChk = $("#loginAuto").prop("checked")
			$.ajax({
				url:"/user/loginCheck.do",
				type:"post",
				data:{
					loginAct:act,
					loginPwd:$("#loginPwd").val(),
					loginAuto:loginChk
				},
				success(data){
					if(data.success){
						//等路成功：进行页面跳转：
						location="/workbench/index.html";

					}
					if(data.msg){
						alert(data.msg)
					}
				}

			})




		})


		//获取cookie的值！如果有值，则直接将账号和密码发送到后端请求验证




	})







</script>

</head>
<body>
	<div style="position: absolute; top: 0px; left: 0px; width: 60%;">
		<img src="/static/image/IMG_7114.JPG" style="width: 100%; height: 90%; position: relative; top: 50px;">
	</div>
	<div id="top" style="height: 50px; background-color: #3C3C3C; width: 100%;">
		<div style="position: absolute; top: 5px; left: 0px; font-size: 30px; font-weight: 400; color: white; font-family: 'times new roman'">CRM &nbsp;<span style="font-size: 12px;">&copy;2017&nbsp;动力节点</span></div>
	</div>
	
	<div style="position: absolute; top: 120px; right: 100px;width:450px;height:400px;border:1px solid #D5D5D5">
		<div style="position: absolute; top: 0px; right: 60px;">
			<div class="page-header">
				<h1>登录</h1>
			</div>
			<form action="" class="form-horizontal" role="form">
				<div class="form-group form-group-lg">
					<div style="width: 350px;">
						<input id="loginAct" name="loginAct" class="form-control" type="text" placeholder="用户名">
					</div>
					<div style="width: 350px; position: relative;top: 20px;">
						<input id="loginPwd" name="loginPwd"  class="form-control" type="password" placeholder="密码">
					</div>
					<div class="checkbox"  style="position: relative;top: 30px; left: 10px;">
						<label>
							<input id="loginAuto" type="checkbox"> 十天内免登录
						</label>
					</div>
					<button type="button" id="btn" class="btn btn-primary btn-lg btn-block"  style="width: 350px; position: relative;top: 45px;">登录</button>
				</div>
			</form>
		</div>
	</div>
</body>
</html>